package pl.perseus.dao;
 
import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import pl.perseus.model.Rach;
import pl.perseus.model.User;

@Repository
public class UserDao extends BaseDao<User> implements IUserDao{
 
	
	public UserDao() {
		super("User");
	}

	@Override
    public User selectByLoginUser(String login) {
    	Map<String, Object> map = new HashMap<String, Object>();
    	map.put("login", login);
        return queryForObject("getByLoginUser", map);
    }
	
	@Override
	public User insertUser(User user){
		return insertBean("insertUser", user);
	}

	@Override
	public User updateUser(User u) {
		return updateBean("updateUser", u);
	}
	
	@Override
	public User getUserForRach(Rach rach){
		Map<String, Object> map = new HashMap<String, Object>();
    	map.put("rachId", rach.getId());
		return queryForObject("getByRachId", map);
	}

}
